package com.ycw.service.guoguo.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ycw.bean.ProjectsType;
import com.ycw.dao.ProjectsTypeMapper;
import com.ycw.service.guoguo.ClassificationService;
import com.ycw.util.Msg;

import tk.mybatis.mapper.entity.Example;
@Service
public class ClassificationServiceImpl implements ClassificationService {

	@Autowired
	private ProjectsTypeMapper projectsTypeMapper;
	
	@Override
	public Msg getAllClass() {
		return Msg.success().add("list", projectsTypeMapper.selectAll());
	}

	@Override
	public Msg addClass(ProjectsType projectsType) {
		
		if(projectsTypeMapper.insertSelective(projectsType)>0){
			return Msg.success();
		}
		return Msg.fail();
	}

	@Override
	public Msg deleteClassById(ProjectsType projectsType) {
		if(projectsTypeMapper.deleteByPrimaryKey(projectsType.getPstId())>0){
			return Msg.success();
		}
		return Msg.fail();
	}

	@Override
	public Msg alertClassById(ProjectsType projectsType) {
		if(projectsTypeMapper.updateByPrimaryKeySelective(projectsType)>0){
			return Msg.success();
		}
		return Msg.fail();
	}

}
